﻿import java.util.Scanner;

public class prac_02 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		System.out.println("请输入年份：");
		if(sc.hasNextInt()){
			int year = sc.nextInt();
			System.out.println("请输入月份：");

			if(sc.hasNextInt()){
				int month = sc.nextInt();
				switch(month){
				case 1:
					System.out.println("31");
					break;
				case 2:
					if((year%4==4&&year%100!=0)||year%400==0){
						System.out.println("29");
						break;
					}else{
						System.out.println("28");
						break;
					}
				case 3:
					System.out.println("31");
					break;
				case 4:
					System.out.println("30");
					break;
				case 5:
					System.out.println("31");
					break;
				case 6:
					System.out.println("30");
					break;
				case 7:
					System.out.println("31");
					break;
				case 8:
					System.out.println("31");
					break;
				case 9:
					System.out.println("30");
					break;
				case 10:
					System.out.println("31");
					break;
				case 11:
					System.out.println("30");
					break;
				case 12:
					System.out.println("31");
					break;
				default:
					System.out.println("月份为1~12月，请检查后重新输入！");

				}
			}else{
				System.out.println("请输入正确的月份！");
			}
		}else{
			System.out.println("请输入正确的年份！");
		}

	}
}